/*
 * Copyright 2006-2023 www.anyline.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package org.anyline.metadata.type;

import org.anyline.adapter.KeyAdapter.KEY_CASE;

import java.io.Serializable;

public enum DatabaseType implements Serializable {
        NONE			    ("NONE"	    , KEY_CASE.SRC,"",""),
        AnalyticDB_MySQL	("AnalyticDB"	, KEY_CASE.SRC,"com.mysql.cj.jdbc.Driver","jdbc:mysql://{host}:{port:3306}/{database}[?{param}]"),
        AnalyticDB_PG		("AnalyticDB"	, KEY_CASE.SRC,"org.postgresql.Driver","jdbc:postgresql://{sever}:{port:5432}/{database}}"),
        AntDB			    ("AntDB"	    , KEY_CASE.SRC,"org.postgresql.Driver","jdbc:postgresql://{sever}:{port:5432}/{database}}"),//http://www.antdb.net/
        Cache			    ("Cache"	    , KEY_CASE.SRC,"com.intersys.jdbc.CacheDriver","jdbc:Cache://{host}:{port}/{database}"),
        Cassandra			("CASSANDRA"	, KEY_CASE.SRC,"org.apache.cassandra.cql.jdbc.CassandraDriver","jdbc:cassandra://{host}:{port/{database}"),
        ClickHouse			("CLICKHOUSE"	, KEY_CASE.SRC, "ru.yandex.clickhouse.ClickHouseDriver","jdbc:clickhouse://{host}:{port:8123}/{database}"),
        CirroData			("CirroData"	, KEY_CASE.SRC, "com.bonc.xcloud.jdbc.XCloudDriver","jdbc:xcloud:@{host}:{port}/{database}"),
        ChinaMobileDB   	("磐维数据库"    , KEY_CASE.SRC,"org.postgresql.Driver","jdbc:postgresql://{sever}:{port:5432}/{database}}"),
        ChinaUnicomDB   	("中国联通"      , KEY_CASE.SRC,"org.postgresql.Driver","jdbc:postgresql://{sever}:{port:5432}/{database}}"),
        Citus   			("Citus"	    , KEY_CASE.SRC,"org.postgresql.Driver","jdbc:postgresql://{sever}:{port:5432}/{database}}"),
        CockroachDB			("CockroachDB"	, KEY_CASE.SRC,"org.postgresql.Driver","jdbc:postgresql://{sever}:{port:5432}/{database}}"), //https://www.cockroachlabs.com/docs/
        DB2					("db2"			, KEY_CASE.SRC,"com.ibm.db2.jcc.DB2Driver","jdbc:db2://{host}:{port:50000}/{database}"),
        Derby  				("Derby"		, KEY_CASE.SRC,"org.apache.derby.jdbc.EmbeddedDriver","jdbc:derby:{database}[;{param}]"),
        DM		 			("达梦"			, KEY_CASE.SRC,"dm.jdbc.driver.DmDriver","jdbc:dm://{host}:{port:5236}/{database}"), //dbc:dm://192.168.0.2:5236,192.168.0.3:5236/DATABASE_NAME
        Doris		 		("Doris"		, KEY_CASE.SRC,"com.mysql.cj.jdbc.Driver","jdbc:mysql://{host}:{port:3306}/{database}[?{param}]"),
        ElasticSearch		("ElasticSearch", KEY_CASE.SRC,"",""),
        FusionInsight 		("FusionInsight", KEY_CASE.SRC,"org.apache.hive.jdbc.HiveDriver","jdbc:hive2://{host}:{port}/{database}"),
        GBase8A             ("南大通用"		, KEY_CASE.SRC,"com.gbase.jdbc.Driver","jdbc:gbase://{host}:{port:5258}/{database}"),
        //jdbc:gbasedbt-sqli://[{ip-address|host-name}:{port-number|server-name}][/dbname]:GBASEDBTSERVER=servername[{;user=user;password=password]|CSM=(SSO=database_server@realm,ENC=true)}[;name=value[;name=value]...]
        //直连 jdbc:gbasedbt-direct://[/dbname:;[user=user;password=password]][;name=value[;name=value]...]
        GBase8S             ("南大通用"		, KEY_CASE.SRC,"com.gbase.jdbc.Driver","jdbc:gbasedbt-sqli://{host}:{port:1533}/{database}:GBASEDBTSERVER={server};user={user};password={password}"),
        GaussDB100  		("GaussDB 100"	, KEY_CASE.SRC,"com.huawei.gauss.jdbc.ZenithDriver","jdbc:zenith:@{host}:{port}[?param]"),
        GBase200  			("GaussDB 200"	, KEY_CASE.SRC,"com.huawei.gauss200.jdbc.Driver","jdbc:gaussdb://{host}:{port:25308}/{database}"),
        GaiaDB  			("百度GaiaDB-X"	, KEY_CASE.SRC,"com.mysql.cj.jdbc.Driver","jdbc:mysql://{host}:{port:3306}/{database}[?{param}]"),
        GoldenDB  			("中兴GoldenDB"	, KEY_CASE.SRC,"com.mysql.cj.jdbc.Driver","jdbc:mysql://{host}:{port:3306}/{database}[?{param}]"),
        GreatDB  			("万里数据库"	, KEY_CASE.SRC,"com.mysql.cj.jdbc.Driver","jdbc:mysql://{host}:{port:3306}/{database}[?{param}]"),//https://www.greatdb.com/ https://greatsql.cn/docs/8032/
        Greenplum           ("Greenplum"   , KEY_CASE.SRC, "com.pivotal.jdbc.GreenplumDriver", "jdbc:pivotal:greenplum://{host}:{port};DatabaseName={database}"),
        H2  				("H2"			, KEY_CASE.SRC,"org.h2.Driver","jdbc:h2:{database}"),
        Hbase  				("Hbase"		, KEY_CASE.SRC,"org.apache.phoenix.jdbc.PhoenixDriver"," jdbc:phoenix:{host}:{port}/{database}"),
        HANA  				("SAP HANA"    , KEY_CASE.SRC,"com.sap.db.jdbc.Driver","jdbc:sap://{host}:{port}[?{param}]"),
        HashData  			("酷克数据"	    , KEY_CASE.SRC,"org.postgresql.Driver","jdbc:postgresql://{sever}:{port:5432}/{database}}"),//https://www.hashdata.xyz/
        HighGo				("瀚高"			, KEY_CASE.SRC,"com.highgo.jdbc.Driver","jdbc:highgo://{host}:{port:5866}/{database}"),
        Hive				("Hive"		, KEY_CASE.SRC,"org.apache.hive.jdbc.HiveDriver","jdbc:hive2://{host}:{port}/{database}"),
        HotDB  			    ("热璞"         , KEY_CASE.SRC,"com.mysql.cj.jdbc.Driver","jdbc:mysql://{host}:{port:3306}/{database}[?{param}]"),
        HSQLDB  			("HSQLDB"		, KEY_CASE.SRC,"org.hsqldb.jdbcDriver"," jdbc:hsqldb:file:{database}"), //https://hotdb.com/index
        Ignite  			("Ignite"		, KEY_CASE.SRC,"org.apache.ignite.IgniteJdbcThinDriver",""),
        InfluxDB			("InfluxDB"	, KEY_CASE.SRC,"","jdbc:influxdb://{host}:{port}/{database}"),
        Informix			("Informix"	, KEY_CASE.SRC,"com.informix.jdbc.IfxDriver","jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}"),
        Impala              ("Impala"      , KEY_CASE.SRC, "com.cloudera.impala.jdbc41.Driver","jdbc:impala://{host}:{port}/{database}[;{param}]"),
        IoTDB			    ("IoTDB"	    , KEY_CASE.SRC,"org.apache.iotdb.jdbc.IoTDBDriver",""),
        //https://learning.intersystems.com/course/view.php?name=JDBC%20and%20InterSystems%20IRIS
        IRIS			    ("IRIS"	    , KEY_CASE.SRC," com.intersystems.jdbc.IRISDriver","jdbc:IRIS://{host}:{port}/{database}"),
        KingBase			("人大金仓"		, KEY_CASE.UPPER,"com.kingbase8.Driver","jdbc:kingbase8://{host}:{port:54321}/{database}"),
        KunDB			    ("星环"		    , KEY_CASE.UPPER,"com.mysql.cj.jdbc.Driver","jdbc:mysql://{host}:{port:3306}/{database}[?{param}]"),
        kylin               ("Kylin"       , KEY_CASE.SRC, "org.apache.kylin.jdbc.Driver"," jdbc:kylin://{host}:{port:7070}/{database}"),
        LightDB			    ("恒生电子"		, KEY_CASE.UPPER,"org.postgresql.Driver","jdbc:postgresql://{sever}:{port:5432}/{database}"),
        MariaDB				("MariaDB"		, KEY_CASE.SRC,"org.mariadb.jdbc.Driver",""),
        MaxDB				("MaxDB"		, KEY_CASE.SRC,"com.sap.dbtech.jdbc.DriverSapDB",""),
        MaxCompute			("MaxCompute"		, KEY_CASE.SRC,"com.aliyun.odps.jdbc.OdpsDriver","jdbc:odps:{host}?project={database}"),
        MongoDB				("MongoDB"		, KEY_CASE.SRC,"","mongodb://[{user}:{password}@]{host}:{port:27017}/{database}"),
        MogDB				("云和恩墨"		, KEY_CASE.SRC,"org.postgresql.Driver","jdbc:postgresql://{sever}:{port:5432}/{database}"),
        MonetDB				("MonetDB"		, KEY_CASE.SRC,"org.monetdb.jdbc.MonetDriver","jdbc:monetdb://{host}:{port}/{database}"),
        MSSQL				("SQL Server 2005+"	, KEY_CASE.SRC,"com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver://{host}:{port:1433};databaseName={database}"),
        MSSQL2000			("SQL Server 2000"	, KEY_CASE.SRC,"com.microsoft.jdbc.sqlserver.SQLServerDriver","jdbc:microsoft:sqlserver://{host}:{port:1433};databaseName={database}"),
        MuDB				("沐融信息科技"	, KEY_CASE.SRC,"org.postgresql.Driver","jdbc:postgresql://{sever}:{port:5432}/{database}"),
        MYSQL				("MySQL"		, KEY_CASE.SRC,"com.mysql.cj.jdbc.Driver","jdbc:mysql://{host}:{port:3306}/{database}[?{param}]"),
        Neo4j  				("Neo4j"		, KEY_CASE.SRC,"org.neo4j.jdbc.Driver","jdbc:neo4j:http://{host}:{port:7474}"),
        OceanBase 			("OceanBase"	, KEY_CASE.SRC,"com.oceanbase.jdbc.Driver","jdbc:oceanbase://{host}:{port}/{database}"),
        OpenGauss           ("高斯"			, KEY_CASE.SRC,"org.opengauss.Driver","jdbc:opengauss://{host}:{port:5432}/{database}"),
        ORACLE				("Oracle"		, KEY_CASE.SRC,"oracle.jdbc.OracleDriver","jdbc:oracle:thin:@{host}:{port:1521}/{database}"),
        oscar				("神舟通用"		, KEY_CASE.SRC,"com.oscar.Driver","jdbc:oscar://{host}:{port:2003}/{database}"),
        Phoenix             ("Phoenix"     , KEY_CASE.SRC, "org.apache.phoenix.jdbc.PhoenixDriver","jdbc:phoenix:{host}:{port:2181}/{database}"),
        PolarDB  			("PolarDB"		, KEY_CASE.SRC,"com.aliyun.polardb.Driver","jdbc:polardb://{host}:{port:5432}/{database}"),
        PostgreSQL 			("PostgreSQL"	, KEY_CASE.SRC,"org.postgresql.Driver","jdbc:postgresql://{host}:{port:5432}/{database}"),
        Presto              ("Presto"      , KEY_CASE.SRC, "com.facebook.presto.jdbc.PrestoDriver","jdbc:presto://{host}:{port}/{database}"),
        QuestDB 			("QuestDB"		, KEY_CASE.SRC,"org.postgresql.Driver","jdbc:postgresql://{host}:{port:5432}/{database}"),
        RapidsDB            ("柏睿数据"    , KEY_CASE.SRC, "com.boraydata.jdbc.Driver","jdbc:rpdsql://{host}:{port}/{database}"),
        Redshift  			("Redshift"	, KEY_CASE.SRC,"com.amazon.redshift.jdbc4.Driver","jdbc:redshift://{host}:{port}/{database}"),
        RethinkDB  			("RethinkDB"	, KEY_CASE.SRC,"",""), //https://rethinkdb.com/
        SinoDB  			("星瑞格"	    , KEY_CASE.SRC,"com.informix.jdbc.IfxDriver","jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}"),
        SelectDB   			("SelectDB"	, KEY_CASE.SRC,"com.mysql.jdbc.Driver","jdbc:mysql://{host}:{port:3306}/{database}[?{param}]"),
        //https://docs.snowflake.com/en/developer-guide/jdbc/jdbc-configure
        Snowflake           ("Snowflake"    , KEY_CASE.SRC, " net.snowflake.client.jdbc.SnowflakeDriver", "jdbc:snowflake://{host}/?{param}"),
        Spark               ("Spark"       , KEY_CASE.SRC, "org.apache.hive.jdbc.HiveDriver", "jdbc:hive2://{host}:{port}/{database}"),
        SQLite  			("SQLite"		, KEY_CASE.SRC,"org.sqlite.JDBC","jdbc:sqlite:{database}"),
        StarDB  			("京东StarDB"	, KEY_CASE.SRC,"com.mysql.jdbc.Driver","jdbc:mysql://{host}:{port:3306}/{database}[?{param}]"),
        StarRocks  			("StarRocks"	, KEY_CASE.SRC,"com.mysql.jdbc.Driver","jdbc:mysql://{host}:{port:3306}/{database}[?{param}]"),
        Sybase  			("Sybase"	    , KEY_CASE.SRC,"com.sybase.jdbc4.jdbc.SybDriver","jdbc:sybase:Tds:{host}:{port}/{database}"),
        TDengine  			("TDengine"	, KEY_CASE.SRC,"com.taosdata.jdbc.TSDBDriver","jdbc:TAOS://{host}:{port:6030}/{database}[?user={user}&password={password}]"),
        TeraData            ("TeraData"    , KEY_CASE.SRC, "com.ncr.teradata.TeraDriver", "jdbc:teradata://{host}/DATABASE={database},DBS_PORT={port:1025}"),
        TimesTen           ("TimesTen"   , KEY_CASE.SRC, "com.timesten.jdbc.TimesTenClientDriver", "jdbc:timesten:client:dsn={database}"),
        Transwarp           ("Transwarp"   , KEY_CASE.SRC, "org.apache.hive.jdbc.HiveDriver", "jdbc:hive2://{host}:{port}/{database}"),
        UXDB			    ("优炫数据库"	, KEY_CASE.SRC,"com.uxsino.uxdb.Driver","jdbc:uxdb://{host}:{port:5432}/{database}"),
        UbiSQL    			("平安科技"	    , KEY_CASE.SRC,"com.mysql.jdbc.Driver","jdbc:mysql://{host}:{port:3306}/{database}[?{param}]"),
        TiDB    			("TiDB"	    , KEY_CASE.SRC,"com.mysql.jdbc.Driver","jdbc:mysql://{host}:{port:3306}/{database}[?{param}]"),
        TDSQL    			("TDSQL"	    , KEY_CASE.SRC,"com.mysql.jdbc.Driver","jdbc:mysql://{host}:{port:3306}/{database}[?{param}]"),
        Timescale			("Timescale"	, KEY_CASE.SRC,"org.postgresql.Driver","jdbc:postgresql://{host}:{port:5432}/{database}"),
        Vastbase			("海量数据"	, KEY_CASE.SRC,"org.postgresql.Driver","jdbc:postgresql://{host}:{port:5432}/{database}"),
        VoltDB			    ("VoltDB"	    , KEY_CASE.SRC,"org.voltdb.jdbc.Driver","jdbc:voltdb://{host}:{port:21212}"),//"jdbc:voltdb://svr1:21212,svr2:21212"
        Vertica             ("Vertica"     , KEY_CASE.SRC, "com.vertica.jdbc.Driver","jdbc:vertica://{host}:{port:5433}/{database}"),
        xigemaDB			("华胜信泰"	    , KEY_CASE.SRC,"com.informix.jdbc.IfxDriver","jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}"),
        YiDB			    ("天翼数智"	    , KEY_CASE.SRC,"com.mysql.jdbc.Driver","jdbc:mysql://{host}:{port:3306}/{database}[?{param}]")
        ;
        DatabaseType(String title, KEY_CASE objectNameCase, String driver, String template){
                this.title = title;
                this.driver = driver;
                this.objectNameCase = objectNameCase;
                this.template = template;
        }
        //时查询系统表时对象名(表名、列表)是否大写
        private final KEY_CASE objectNameCase;
        private final String title;
        private final String driver;
        private final String template;
        public String driver(){
                return driver;
        }
        public String getTitle(){
                return title;
        }
        public KEY_CASE nameCase(){
                return objectNameCase;
        }

}
